# Maintainer: Konstantin Podsvirov <konstantin@podsvirov.su>

_realname=kombu
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-$_realname")
pkgver=5.5.3
pkgrel=1
pkgdesc='A messaging library for Python (mingw-w64)'
arch=('any')
mingw_arch=('ucrt64' 'clang64' 'clangarm64')
msys2_references=(
  'purl: pkg:pypi/kombu'
)
msys2_repository_url='https://github.com/celery/kombu'
url='https://kombu.readthedocs.io'
license=('spdx:BSD-3-Clause')
depends=(
  "${MINGW_PACKAGE_PREFIX}-python"
  "${MINGW_PACKAGE_PREFIX}-python-amqp"
  "${MINGW_PACKAGE_PREFIX}-python-vine"
  "${MINGW_PACKAGE_PREFIX}-python-tzdata"
)
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-python-build"
  "${MINGW_PACKAGE_PREFIX}-python-installer"
  "${MINGW_PACKAGE_PREFIX}-python-setuptools"
  "${MINGW_PACKAGE_PREFIX}-python-wheel"
)
checkdepends=(
  "${MINGW_PACKAGE_PREFIX}-python-boto3"
  "${MINGW_PACKAGE_PREFIX}-python-msgpack"
  "${MINGW_PACKAGE_PREFIX}-python-pycurl"
  "${MINGW_PACKAGE_PREFIX}-python-pytest"
  "${MINGW_PACKAGE_PREFIX}-python-pytz"
  "${MINGW_PACKAGE_PREFIX}-python-redis"
  "${MINGW_PACKAGE_PREFIX}-python-sqlalchemy"
  "${MINGW_PACKAGE_PREFIX}-python-yaml"
)
optdepends=(
  #"${MINGW_PACKAGE_PREFIX}-python-consul: for Consul K/V store Transport support" # Not packaged yet
  #"${MINGW_PACKAGE_PREFIX}-python-etcd: for etcd support" # Not packaged yet
  #"${MINGW_PACKAGE_PREFIX}-python-librabbitmq: C optimization for AMQP transport" # Deprecated, moved to AUR
  #"${MINGW_PACKAGE_PREFIX}-python-pycouchdb: for CouchDB support" # Not packaged yet
  #"${MINGW_PACKAGE_PREFIX}-python-softlayer-messaging: for SoftLayer Message Queue support" # Not packaged yet
  #"${MINGW_PACKAGE_PREFIX}-python-brotli: for brotli compression support"
  #"${MINGW_PACKAGE_PREFIX}-python-kazoo: for Zookeeper support"
  #"${MINGW_PACKAGE_PREFIX}-python-pymongo: for MongoDB support"
  #"${MINGW_PACKAGE_PREFIX}-python-pyro: for Pyro support"
  "${MINGW_PACKAGE_PREFIX}-python-boto3: for Amazon SQS support"
  "${MINGW_PACKAGE_PREFIX}-python-msgpack: for MessagePack support"
  "${MINGW_PACKAGE_PREFIX}-python-pycurl: for Amazon SQS support"
  "${MINGW_PACKAGE_PREFIX}-python-redis: for Redis support"
  "${MINGW_PACKAGE_PREFIX}-python-sqlalchemy: for SQLAlchemy support"
  "${MINGW_PACKAGE_PREFIX}-python-yaml: for YAML support"
  "${MINGW_PACKAGE_PREFIX}-python-zstandard: for zstd compression support"
)

source=("https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('021a0e11fcfcd9b0260ef1fb64088c0e92beb976eb59c1dfca7ddd4ad4562ea2')

build() {
  cp -r "${_realname}-${pkgver}" "python-build-${MSYSTEM}" && cd "python-build-${MSYSTEM}"
  ${MINGW_PREFIX}/bin/python -m build --wheel --skip-dependency-check --no-isolation
}

check() {
  cd "${srcdir}/python-build-${MSYSTEM}"
  ${MINGW_PREFIX}/bin/pytest || true
}

package() {
  cd "${srcdir}/python-build-${MSYSTEM}"

  MSYS2_ARG_CONV_EXCL="--prefix=" \
    ${MINGW_PREFIX}/bin/python -m installer --prefix=${MINGW_PREFIX} \
    --destdir="${pkgdir}" dist/*.whl

  install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}
